/**
 * 2016，thor.com，all rights reserved。
 * 
 * Project：		palmmall-core
 * Filename：	SCodeNameQueryParamConverter.java
 * Created：		2016年9月20日
 * Creator：		wolv
 */
package com.thor.palmmall.rest.common;

import org.springframework.core.convert.converter.Converter;

import com.thor.palmmall.spi.common.SCodeNameQueryParam;

/**
 * @author wolv
 *
 */
public class SCodeNameQueryParamConverter implements Converter<ACodeNameQueryParam, SCodeNameQueryParam> {

	public static SCodeNameQueryParamConverter getInstance() {
		if (instance == null)
			instance = new SCodeNameQueryParamConverter();
		return instance;
	}

	private static SCodeNameQueryParamConverter instance;

	private SCodeNameQueryParamConverter() {
	}

	@Override
	public SCodeNameQueryParam convert(ACodeNameQueryParam source) {
		if (source == null)
			return null;

		SCodeNameQueryParam target = new SCodeNameQueryParam();
		target.setPage(source.getPage());
		target.setPageSize(source.getPageSize());
		target.setCode(source.getCode());
		target.setName(source.getName());
		target.setRoles(source.getRoles());
		return target;
	}

}
